﻿///////////////////////////////////////////////////////////////////////////////
//              
// Project:          11M001 St Catherine of Siena Parish Brand Identity Internet Site
// Module:           (name of the module)
// Files:            uc_html_editor.ascx.cs
// Creation Date:	 15 February 2011
// Last update:      15 February 2011
//
// Author:           Ivan Vuchich
// Trigram:          IVU
// SVN User Name:    i_vuchich
//
//                   
// Pair Partner:     (name of your pair programming partner)
//      Trigram:     (trigram of the person example RPT, VST)
//
//                   
// File History:     IVU - 15 February 2011 – Initial Version
//
///////////////////////////////////////////////////////////////////////////////


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;


public partial class uc_html_editor : System.Web.UI.UserControl
{
   
/// <summary>
    /// Local variables
    /// </summary>
    private int width_html_editor;
    //faq
    private string faq_Visible = System.Configuration.ConfigurationManager.AppSettings["faq_Visible"];
    //login
    private string login_Visible = System.Configuration.ConfigurationManager.AppSettings["login_Visible"];
    
    //public variable on which the type of editor depends
    public static string editorType = System.Configuration.ConfigurationManager.AppSettings["editor_type"];

    /// <summary>
    /// Public property providing access to the internal HTML code
    /// of the rich text editor. Depending on the global string
    /// variable <code>editorType</code> we choose to provide access
    /// to FTB or MCE editors
    /// </summary>
    public string htmlCode
    {
        get {
            if (editorType.ToUpper() == "MCE")
                return this.text_area.Value;
            else if (editorType.ToUpper() == "FCK")
                return this.FCKeditor.Value;
            else 
                return "unsupported editor type";

            }
        set {
            if (editorType.ToUpper() == "MCE")
                this.text_area.Value = value;
            else if (editorType.ToUpper() == "FCK")
                this.FCKeditor.Value = value;

        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        //dinamicly changing the width of the main table
        if ((faq_Visible == "true") && (login_Visible == "true"))
        {
            width_html_editor = 110;
        }
        else
        {
            if (login_Visible == "true")
            {
                width_html_editor = 100;
            }
            else
            {
                if (faq_Visible == "true")
                {
                    width_html_editor = 95;
                }
                else
                {
                    width_html_editor = 80;
                }
            }
        }
        text_area.Cols = width_html_editor;
        
    }
}

